Skip to content

fix(runner): initialize the env map when a staged login returns none - #1189

Open
jasonQin6 wants to merge 1 commit into
Tencent:mainfrom
jasonQin6:fix/runner-nil-env-staged-login
Open

jasonQin6 wants to merge 1 commit into
Tencent:mainfrom
jasonQin6:fix/runner-nil-env-staged-login

Conversation

@jasonQin6

Copy link
Copy Markdown

Problem

PrepareRunnerAgentCLILogin assigns env["HOME"] on the map returned by prepareRunnerLogin without a nil check. The generic tail of prepareRunnerLogin returns cleanup, nil, nil — only the codex/claude-code OAuth branches and the Antigravity branch build a non-nil env map. Today no runnerLoginSpec entry flows through the generic tail, so this is latent; adding one (e.g. a CLI whose account login is a single staged file without OAuth refresh) panics the runner daemon:

panic: assignment to entry in nil map
goroutine ... agentflow/internal/runtime.PrepareRunnerAgentCLILogin(...)
	agentflow/internal/runtime/conversation_runner_login.go:94

From the platform side the failure surfaces as an expired task lease, which points investigation away from the real cause.

Fix

Initialize the env map when the staged login returns none, so env["HOME"] / env["TMPDIR"] land safely on the generic path. No behavior change for codex, claude-code and antigravity.

Verified on a self-hosted instance: a login spec routed through the generic path panics before the guard and runs cleanly after it.

The generic tail of prepareRunnerLogin returns a nil env map. The three
providers currently in runnerLoginSpec never hit that tail (the codex and
claude-code OAuth branches and the Antigravity branch each build their own
maps), so PrepareRunnerAgentCLILogin has always assigned env["HOME"] on a
non-nil map. Adding a login spec whose staged login flows through the
generic path panics the runner daemon (assignment to entry in nil map),
which surfaces as an expired lease on the platform.

Guard with an empty map so env["HOME"] and env["TMPDIR"] land safely.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant